const express = require('express')
const router = express.Router()
const result = require('../db/result')

router.post('/userInfo',(req,res)=>{
    // console.log(req.body)
    let nickname=req.body.userInfo.nickname
    let personalized_signature=req.body.userInfo.personalized_signature
    let email=req.body.userInfo.email
    let name=req.body.name
    let sql=`UPDATE user 
             SET nickname='${nickname}',email='${email}',personalized_signature='${personalized_signature}，'
             WHERE user.name='${name}';
             `
    result(sql, res)
    }
)

router.get('/getUserInfo',(req,res)=>{
    // console.log(req.query.name)
    let sql=`SELECT nickname ,email, personalized_signature, avatar, create_time FROM user WHERE user.name='${req.query.name}'`
    result(sql, res)
})

module.exports=router